package com.zhang.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mysql.jdbc.StringUtils;
import com.zhang.mapper.ILogMapper;
import com.zhang.pojo.LogBean;
import com.zhang.pojo.OutputInfoBean;
import com.zhang.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
@Service
@Transactional

public class LogServiceImpl implements ILogService {

    @Autowired
    private ILogMapper logMapper;

    @Override
    public IPage<LogBean> findByPageAndItem(Page<LogBean> page, LocalDate start, LocalDate end) {
        UpdateWrapper<LogBean> wrapper = new UpdateWrapper<>();
        if (start != null){
            wrapper.ge("l_time",start);
        }if (end != null){
            wrapper.le("l_time",end);
        }
        return logMapper.selectPage(page,wrapper);
    }

    @Override
    public void add(LogBean logBean) {
        logMapper.insert(logBean);
    }
}
